package com.sky.web.data1.user.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sky.web.data1.user.dao.UserDao;
import com.sky.web.data1.user.entity.User;
import com.sky.web.data1.user.service.UserService;

@Service
public class UserServiceImpl implements UserService{
	@Resource
	private UserDao userdao;
	
	@Override
	public List<User> getUsers(User user) {
		System.out.println("===");
		return userdao.getUsers(user);
	}
	
	@Override
	@Transactional
	public void addUser(User user) throws Exception{
		userdao.addUser(user);
		//测试事物
		if(user.getName().equals("wdd")){
			System.out.println(1/0);
		}
	}
	
	@Override
	@Transactional
	public void delUserById(int id) throws Exception {
		userdao.delUserById(id);
	}

}
